package com.example.nit.controller;

import com.alibaba.fastjson.JSON;
import com.example.nit.bean.NumCorrect;
import com.example.nit.bean.ValueCorrect;
import com.example.nit.utils.R;
import com.example.nit.whole.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhao
 * @date 2022/12/10 11:05
 **/
@RestController
@RequestMapping("/spark3")
public class Streaming3Controller {

    @GetMapping("/getStreaming3")
    public R getJudge() {
        List<NumCorrect> result = new ArrayList<>();
        if (Reference.Streaming3List!=null){
            for (String s : Reference.Streaming3List) {
                try {
                    NumCorrect numCorrect = JSON.parseObject(s, NumCorrect.class);
                    result.add(numCorrect);
                } catch (Exception e) {

                }
            }
            Reference.Streaming3List.clear();
        }

        return R.ok().put("result", result);
    }
}
